<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
      <el-form-item label="生产线编号" prop="lineId">
        <el-input
          v-model="queryParams.lineId"
          placeholder="请输入生产线编号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="生产线名称" prop="lineName">
        <el-input
          v-model="queryParams.lineName"
          placeholder="请输入生产线名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="开线时间" prop="startLineTime">
        <el-date-picker clearable
          v-model="queryParams.startLineTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择开线时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['base:productionDay:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['base:productionDay:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['base:productionDay:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['base:productionDay:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table height="calc(100vh - 300px)" v-loading="loading" :data="productionDayList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="公司名称" align="center" prop="factoryName" />
      <el-table-column label="公司代码" align="center" prop="factoryCode" />
      <el-table-column width="120" label="生产线编号" align="center" prop="lineId" />
      <el-table-column width="120" label="生产线名称" align="center" prop="lineName" />
      <el-table-column label="排产数量" align="center" prop="pcNum" />
      <el-table-column label="生产节拍" align="center" prop="pBeat" />
      <el-table-column label="开线时间" align="center" prop="startLineTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startLineTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="年" align="center" prop="year" />
      <el-table-column label="月" align="center" prop="month" />
      <el-table-column label="日" align="center" prop="day" />
      <el-table-column label="星期" align="center" prop="week" />
      <el-table-column label="生产1阶段开始时间" align="center" prop="scStartTime1" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime1, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产1阶段结束时间" align="center" prop="scEndTime1" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime1, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime1" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime1, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产2阶段开始时间" align="center" prop="scStartTime2" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime2, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产2阶段结束时间" align="center" prop="scEndTime2" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime2, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime2" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime2, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产3阶段开始时间" align="center" prop="scStartTime3" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime3, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产3阶段结束时间" align="center" prop="scEndTime3" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime3, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime3" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime3, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产4阶段开始时间" align="center" prop="scStartTime4" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime4, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产4阶段结束时间" align="center" prop="scEndTime4" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime4, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime4" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime4, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产5阶段开始时间" align="center" prop="scStartTime5" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime5, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产5阶段结束时间" align="center" prop="scEndTime5" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime5, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime5" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime5, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产6阶段开始时间" align="center" prop="scStartTime6" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime6, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产6阶段结束时间" align="center" prop="scEndTime6" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime6, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime6" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime6, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产7阶段开始时间" align="center" prop="scStartTime7" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime7, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产7阶段结束时间" align="center" prop="scEndTime7" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime7, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime7" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime7, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产8阶段开始时间" align="center" prop="scStartTime8" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime8, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产8阶段结束时间" align="center" prop="scEndTime8" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime8, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime8" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime8, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产9阶段开始时间" align="center" prop="scStartTime9" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime9, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产9阶段结束时间" align="center" prop="scEndTime9" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime9, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime9" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime9, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产10阶段开始时间" align="center" prop="scStartTime10" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime10, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产10阶段结束时间" align="center" prop="scEndTime10" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime10, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime10" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime10, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产11阶段开始时间" align="center" prop="scStartTime11" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime11, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产11阶段结束时间" align="center" prop="scEndTime11" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime11, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime11" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime11, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产12阶段开始时间" align="center" prop="scStartTime12" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStartTime12, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="生产12阶段结束时间" align="center" prop="scEndTime12" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scEndTime12, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="停止时间" align="center" prop="scStopTime12" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.scStopTime12, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="备注" align="center" prop="remark" />
      <el-table-column width="120" fixed="right" label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['base:productionDay:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['base:productionDay:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改生产日时维护对话框 -->
    <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="公司名称" prop="factoryName">
          <el-input v-model="form.factoryName" placeholder="请输入公司名称" />
        </el-form-item>
        <el-form-item label="公司代码" prop="factoryCode">
          <el-input v-model="form.factoryCode" placeholder="请输入公司代码" />
        </el-form-item>
        <el-form-item label="生产线编号" prop="lineId">
          <el-input v-model="form.lineId" placeholder="请输入生产线编号" />
        </el-form-item>
        <el-form-item label="生产线名称" prop="lineName">
          <el-input v-model="form.lineName" placeholder="请输入生产线名称" />
        </el-form-item>
        <el-form-item label="排产数量" prop="pcNum">
          <el-input v-model="form.pcNum" placeholder="请输入排产数量" />
        </el-form-item>
        <el-form-item label="生产节拍" prop="pBeat">
          <el-input v-model="form.pBeat" placeholder="请输入生产节拍" />
        </el-form-item>
        <el-form-item label="开线时间" prop="startLineTime">
          <el-date-picker clearable
            v-model="form.startLineTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择开线时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="年" prop="year">
          <el-input v-model="form.year" placeholder="请输入年" />
        </el-form-item>
        <el-form-item label="月" prop="month">
          <el-input v-model="form.month" placeholder="请输入月" />
        </el-form-item>
        <el-form-item label="日" prop="day">
          <el-input v-model="form.day" placeholder="请输入日" />
        </el-form-item>
        <el-form-item label="星期" prop="week">
          <el-input v-model="form.week" placeholder="请输入星期" />
        </el-form-item>
        <el-form-item label="生产1阶段开始时间" prop="scStartTime1">
          <el-date-picker clearable
            v-model="form.scStartTime1"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产1阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产1阶段结束时间" prop="scEndTime1">
          <el-date-picker clearable
            v-model="form.scEndTime1"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产1阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime1">
          <el-date-picker clearable
            v-model="form.scStopTime1"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产2阶段开始时间" prop="scStartTime2">
          <el-date-picker clearable
            v-model="form.scStartTime2"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产2阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产2阶段结束时间" prop="scEndTime2">
          <el-date-picker clearable
            v-model="form.scEndTime2"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产2阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime2">
          <el-date-picker clearable
            v-model="form.scStopTime2"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产3阶段开始时间" prop="scStartTime3">
          <el-date-picker clearable
            v-model="form.scStartTime3"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产3阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产3阶段结束时间" prop="scEndTime3">
          <el-date-picker clearable
            v-model="form.scEndTime3"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产3阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime3">
          <el-date-picker clearable
            v-model="form.scStopTime3"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产4阶段开始时间" prop="scStartTime4">
          <el-date-picker clearable
            v-model="form.scStartTime4"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产4阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产4阶段结束时间" prop="scEndTime4">
          <el-date-picker clearable
            v-model="form.scEndTime4"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产4阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime4">
          <el-date-picker clearable
            v-model="form.scStopTime4"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产5阶段开始时间" prop="scStartTime5">
          <el-date-picker clearable
            v-model="form.scStartTime5"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产5阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产5阶段结束时间" prop="scEndTime5">
          <el-date-picker clearable
            v-model="form.scEndTime5"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产5阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime5">
          <el-date-picker clearable
            v-model="form.scStopTime5"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产6阶段开始时间" prop="scStartTime6">
          <el-date-picker clearable
            v-model="form.scStartTime6"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产6阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产6阶段结束时间" prop="scEndTime6">
          <el-date-picker clearable
            v-model="form.scEndTime6"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产6阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime6">
          <el-date-picker clearable
            v-model="form.scStopTime6"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产7阶段开始时间" prop="scStartTime7">
          <el-date-picker clearable
            v-model="form.scStartTime7"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产7阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产7阶段结束时间" prop="scEndTime7">
          <el-date-picker clearable
            v-model="form.scEndTime7"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产7阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime7">
          <el-date-picker clearable
            v-model="form.scStopTime7"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产8阶段开始时间" prop="scStartTime8">
          <el-date-picker clearable
            v-model="form.scStartTime8"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产8阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产8阶段结束时间" prop="scEndTime8">
          <el-date-picker clearable
            v-model="form.scEndTime8"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产8阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime8">
          <el-date-picker clearable
            v-model="form.scStopTime8"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产9阶段开始时间" prop="scStartTime9">
          <el-date-picker clearable
            v-model="form.scStartTime9"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产9阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产9阶段结束时间" prop="scEndTime9">
          <el-date-picker clearable
            v-model="form.scEndTime9"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产9阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime9">
          <el-date-picker clearable
            v-model="form.scStopTime9"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产10阶段开始时间" prop="scStartTime10">
          <el-date-picker clearable
            v-model="form.scStartTime10"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产10阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产10阶段结束时间" prop="scEndTime10">
          <el-date-picker clearable
            v-model="form.scEndTime10"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产10阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime10">
          <el-date-picker clearable
            v-model="form.scStopTime10"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产11阶段开始时间" prop="scStartTime11">
          <el-date-picker clearable
            v-model="form.scStartTime11"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产11阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产11阶段结束时间" prop="scEndTime11">
          <el-date-picker clearable
            v-model="form.scEndTime11"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产11阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime11">
          <el-date-picker clearable
            v-model="form.scStopTime11"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产12阶段开始时间" prop="scStartTime12">
          <el-date-picker clearable
            v-model="form.scStartTime12"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产12阶段开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="生产12阶段结束时间" prop="scEndTime12">
          <el-date-picker clearable
            v-model="form.scEndTime12"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择生产12阶段结束时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="停止时间" prop="scStopTime12">
          <el-date-picker clearable
            v-model="form.scStopTime12"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择停止时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listProductionDay, getProductionDay, delProductionDay, addProductionDay, updateProductionDay } from "@/api/base/productionDay";

export default {
  name: "ProductionDay",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产日时维护表格数据
      productionDayList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        lineId: null,
        lineName: null,
        startLineTime: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询生产日时维护列表 */
    getList() {
      this.loading = true;
      listProductionDay(this.queryParams).then(response => {
        this.productionDayList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        factoryName: null,
        factoryCode: null,
        lineId: null,
        lineName: null,
        pcNum: null,
        pBeat: null,
        startLineTime: null,
        year: null,
        month: null,
        day: null,
        week: null,
        scStartTime1: null,
        scEndTime1: null,
        scStopTime1: null,
        scStartTime2: null,
        scEndTime2: null,
        scStopTime2: null,
        scStartTime3: null,
        scEndTime3: null,
        scStopTime3: null,
        scStartTime4: null,
        scEndTime4: null,
        scStopTime4: null,
        scStartTime5: null,
        scEndTime5: null,
        scStopTime5: null,
        scStartTime6: null,
        scEndTime6: null,
        scStopTime6: null,
        scStartTime7: null,
        scEndTime7: null,
        scStopTime7: null,
        scStartTime8: null,
        scEndTime8: null,
        scStopTime8: null,
        scStartTime9: null,
        scEndTime9: null,
        scStopTime9: null,
        scStartTime10: null,
        scEndTime10: null,
        scStopTime10: null,
        scStartTime11: null,
        scEndTime11: null,
        scStopTime11: null,
        scStartTime12: null,
        scEndTime12: null,
        scStopTime12: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加生产日时维护";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getProductionDay(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改生产日时维护";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateProductionDay(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addProductionDay(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除生产日时维护编号为"' + ids + '"的数据项？').then(function() {
        return delProductionDay(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('base/productionDay/export', {
        ...this.queryParams
      }, `productionDay_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
